package com.study.service.impl.rabbit.direct;

import com.study.service.MessageService;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Service;

/**
 * @desc:
 * @author: panxiyi
 * @date: 2023/5/11 12:36 下午
 */


//@Service
public class MessageServiceRabbitmqDirectImpl implements MessageService {

    @Autowired
    private AmqpTemplate amqpTemplate;

    @Override
    public void sendMessage(String id) {
        System.out.println("加入短信发送队列 --rabbit mq 处理 " + id);
        amqpTemplate.convertAndSend("directExchange", "direct", id);
    }

    @Override
    public String doSendMessage() {
        //String id = amqpTemplate.receiveAndConvert(String.class);
        System.out.println("消费、发送短信");
        return null;
    }
}
